-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable New Architecture in Bluesky on RN 0.76 #6755
base: main
Are you sure you want to change the base?
Conversation
I'm happy to help investigate some of the issues if you'd like it @haileyok. We've already got much experience with all things New Arch related, like: |
Let's temporarily remove that package on this branch so that you're not blocked by that. I raised the problem to bitdrift maintainers. |
Pushed temporary reverts to this branch. |
I have it working already on iOS but Android does not let me download the package for some reason and it doesn't look connected to the new arch. Working on a fix for bottomsheet too. |
Just got this branch running on Android. Nice job! I’m noticing that the home header is glitchy. It seems to flash a wrong state every now and then if you swipe up and down a few times. IMG_2305.mov |
@gaearon I made bottomSheet work on new arch, the issue was due to view flattening and not implementing needed methods in swift module. I also added patch for |
Ok I merged the newest main and bumped |
Have you had a chance to look at the cause of #6755 (comment)? I don't believe this was happening with Paper. |
If I understand it correctly, the header animation is controlled here: https://github.com/bluesky-social/social-app/blob/a3031de19ba41717c8e83b818e294d44577fb434/src/view/com/util/MainScrollProvider.tsx yeah? And then the value is interpreted in transformY here:
headerHeight and when I scroll it down slowly, the headerModeValue is decreasing without any jumps in the value and at the same time, the header jumps a little sometimes, so it must be a problem somewhere deeper. I am no expert in reanimated unfortunately 😞
|
Hm, we can't merge without getting to the root of it. It would be nice to reduce this to a minimal reproducing example (just a single file like |
@gaearon We looked into it with @WoLewicki more. The issue is that when no layout styles are updated, reanimated goes through a fast path, applying props synchronously on the UI thread. This fast path avoids our mechanisms that ensure the correct order of our updates. This results in the header jumping. The fast path causes also other problems, and we want to get rid of it at some point - the problem is that would mean bad performance on lower end devices (so we need more time to figure out how to properly optimize this). We tried to remove this fast path for your case, but for some reason the animation appears laggy (but in a different way - now the header doesn't jump back and forth, it just looks like it's skipping frames). It's weird because the UI thread is fairly unoccupied, so it seems that the animation for some reason is influenced by the heavy load that is done on the JS thread. We added an infinite animation there, and it seems that the performance is directly related to scrolling - we need to investigate that further. |
Makes sense. Thanks for the details. |
@gaearon We came back to the office yesterday and I was finally able to dig deeper into the issue. As I said before the laggy animation is a result of the JS thread being heavily utilized (since we need to synchronize the updates applied on the JS thread with the animation). This is what it looks like:
After some digging it seems that the This is the trace after I removed it from the app: The trace looks better now (and the animation seems to work better) - there is still some room for improvement here (but on the reanimated side). The JS thread now is mostly occupied with c++ state updates that are invoked to synchronize the scroll position with the |
Could be an RN bug! But not sure how to file it. Can you reproduce the same in a minimal app? I'm not sure what the reproducing instructions would be. |
We can definitely remove it to work around. |
Yes, I was able to reproduce it in an expo app with simply this code. Codeimport { Profiler } from "react";
import { StyleSheet, Text, View } from "react-native";
import Animated from "react-native-reanimated";
const data = new Array(200);
function onRender(id: string, phase: string, actualDuration: number) {}
export default function App() {
return (
<Profiler id="app" onRender={onRender}>
<View style={styles.container}>
<Animated.FlatList
data={data}
renderItem={(x) => {
return (
<View style={{ backgroundColor: "red", width: 200, height: 300 }}>
<Text>{x.index}</Text>
</View>
);
}}
/>
</View>
</Profiler>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
},
message: {
textAlign: "center",
paddingBottom: 10,
},
camera: {
flex: 1,
},
buttonContainer: {
flex: 1,
flexDirection: "row",
backgroundColor: "transparent",
margin: 64,
},
button: {
flex: 1,
alignSelf: "flex-end",
alignItems: "center",
},
text: {
fontSize: 24,
fontWeight: "bold",
color: "white",
},
}); |
Ok perfect! I will merge |
Ok I merged the newest |
I'm working on a few gesture-related fixes so we'll need to make sure those don't regress with the transition. Let me finish up that work first and then I'll give this PR another spin. |
PR enabling New Architecture in the app. Based on work from @haileyok in #6211 and a bit on #4853. Great work on those PRs so far 💪
There are still some issues like small input text on iOS, glitches with bottomsheet on both platforms and probably some more.